<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Login</title>
</head>
<body>
<input id="nameInput" placeholder="name"  required>
<input id="passwdInput" placeholder="passwd"  required>
<button id="loginButton">
    confirm
</button>
</body>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>

<script>
    $(document).ready(function () {
        // 执行代码

        $("#loginButton").click(function () {

            var name = $("#nameInput").val();
            var passwd = $("#passwdInput").val();

            $.ajax({
                url: "/StaffLogin",
                type: 'POST',
                data: {
                    'name': name,
                    'passwd': passwd
                },
                dataType: 'text',
                success: function (result) {
                    if (result == 'Succeed') {
                        alert("OK");
                    } else {
                        alert("用户名或密码错误！！！");
                    }
                },
                error: function (xhr, type) {
                    alert("Fatal Error");
                }
            });
        });


    });
</script>
</html>